package cn.kgc.myblog.service.impl;

import cn.kgc.myblog.entity.User;
import cn.kgc.myblog.mapper.UserMapper;
import cn.kgc.myblog.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author shkstart
 * @create 2020-01-02 14:35
 */
@Service
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public Map<String, Object> loginByUser(User user) {
        Map<String, Object> map=new HashMap<>();
        User user1 = userMapper.loginByUser(user);
        map.put("loginStatus",user1);
        return map;
    }

    @Override
    public Map<String, Object> insertUser(User user) {
        Map<String, Object> map=new HashMap<>();
        int i = userMapper.insertUser(user);
        int a = (int) ((Math.random() * 9 + 1) * 100000);
        map.put("insertStatus",i);
        map.put("verify",a);
        return map;
    }
}
